

import hashlib

for i in range(10000):
    tmp=hashlib.md5(str(i).encode()).hexdigest()
    try:
        if tmp[1:2]==tmp[14:15] and tmp[14:15]==tmp[17:18]:
            tmp2=(int(tmp[1:2],16)+int(tmp[14:15],16)+int(tmp[17:18],16))//int(tmp[1:2],16)
            if tmp2==int(tmp[31:32],16):
                print(i)
    except:
        continue